﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminMaster.Master" AutoEventWireup="true" CodeBehind="ExpertRegisterForm.aspx.cs" Inherits="ExpertMIS.Admin.ExpertRegisterForm" %>
<%@ Register Src="UserControl/ExpertRegisterForm.ascx" TagName="ExpertRegisterForm" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        /*添加以下空样式，方便JQuery在Aspx页面中查找到当前用户控件字段*/
        .account{}
        .expert{}
        .password{}
        .name{}
        .email{}
    </style>
<script src="../js/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $(".account").blur(function() {
            // 判断如果为空，则直接返回，不去服务端验证重名
            var acct = $(".account").val();
            if (!acct) {
                return;
            }
            $.get("../Service/CheckDupAccount.aspx", { account: acct }, function(retrive) {
                $(".error").empty();
                if (retrive == "true") {
                    $(".error").hide();
                } else if (retrive == "false") {
                    $("<span'>帐号已经被占用，请更改用户名</span>").prependTo(".error");
                    $(".error").show();
                    $(".account").focus();
                }
            });
        });

        $('#<%=lbSave.ClientID %>').click(function() {
            return doClientCheck();
        });

        function doClientCheck() {
            $(".error").empty();
            var isValid = true;
            // 检查帐号是否为空
            var account = $(".account").val();
            if (!account) {
                $("<span>登录帐号不允许为空!</span>").prependTo(".error");
                isValid = false;
            }

            // 检查是否选择专家列表
            var expert = $(".expert").val();
            if (!expert) {
                $("<span>专家列表不允许为空!</span>").prependTo(".error");
                isValid = false;
            }

            // 检查密码是否为空
            var pwd = $(".password").val();
            if (!pwd) {
                $("<span>密码不允许为空!</span>").prependTo(".error");
                isValid = false;
            }

            if (!isValid) {
                $(".error").show();
                return false;
            }
            return true;
        }
    });
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <uc1:ExpertRegisterForm ID="erExpert" runat="server" />
    <div style="text-align: center">
        <asp:Button runat="server" ID="lbSave" Text="保存" OnClick="lbSave_Click"></asp:Button>
        &nbsp;|&nbsp;
        <asp:Button runat="server" ID="lbBack" Text="返回" OnClick="lbBack_Click" /></asp:LinkButton>
    </div>
</asp:Content>
